<template>
	<el-dialog :model-value="visible" :title="msg" @close="handleClose">
		<el-button type="primary" @click="confirm()">确定</el-button>
	</el-dialog>
</template>

<script setup lang="ts">
interface Props {
	msg: string;
	visible: boolean;
	close?: () => void;
	confirm?: (data: any) => void;
}

let data = reactive({});
const props = defineProps<Props>();

const emit = defineEmits(["update:visible"]);

/**
 * 确定
 */
const confirm = async () => {
	// 省略validate表单校验的代码
	// 这里的data为表单中输入的账号密码
	props.confirm?.(data);
	handleClose();
};
/**
 * 关闭
 */
const handleClose = () => {
	emit("update:visible", false);
	props.close?.();
};
</script>

<style lang="scss" scoped></style>
